import { PageContainer } from "@ant-design/pro-components";
import {
  Button,
  Modal,
  Input,
  Form,
  Tabs,
  DatePicker,
  Select,
  Radio,
  Space,
  message,
  InputNumber,
} from "antd";
import { useState, forwardRef, useImperativeHandle, useEffect } from "react";
import styles from "./styles.less";

const { TextArea } = Input;
import dayjs from "dayjs";

export default forwardRef((props, ref) => {
  const { row } = props;
  const [open, setOpen] = useState(false);
  const [form] = Form.useForm();

  const submitForm = async () => {
    await form.validateFields();
    setOpen(false);
    message.success("操作成功");
  };

  useImperativeHandle(ref, () => ({
    setOpen,
  }));

  useEffect(() => {
    console.log(row);
    if (row?.id) {
      form.setFieldsValue({
        ...row,
        startDate: dayjs(row.startDate),
        endDate: dayjs(row.endDate),
      });
    }
  }, [row]);

  // return (

  // )
});

// export default Dom
